import torch

in_channels, out_channels = 5, 10
width, height = 100, 100
kernel_size = 3
batch_size = 1

input = torch.randn(batch_size, in_channels, width, height)

conv_layer = torch.nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size)
print(conv_layer.weight.shape)  # torch.Size([10, 5, 3, 3])
print(conv_layer.bias.shape)  # torch.Size([10])

out_channels = conv_layer(input)

print(f"输入形状: {input.shape}")
print(f"输出形状: {out_channels.shape}")
print(conv_layer.weight.shape)
